<%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2020/7/27
  Time: 21:26
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>快递员注册</title>

    <%--jq--%>
    <script src="${pageContext.request.contextPath}/static/jquery/jquery-3.5.1.js" type="text/javascript"></script>
    <%--    laiui 框架--%>
    <script src="${pageContext.request.contextPath}/static/layui/layui.js" type="text/javascript"
            charset="utf-8"></script>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/layui/css/layui.css"/>
    <%--    bootstrap 框架--%>
    <script src="${pageContext.request.contextPath}/static/bootstrap/js/bootstrap.js" type="text/javascript"></script>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/bootstrap/css/bootstrap.css" type='text/css'>

    <%--    font-awesome 图标库--%>
    <link href="${pageContext.request.contextPath}/front/css/font-awesome.min.css" type="text/css" rel="stylesheet">
    <%--    百度地图API--%>
    <%--    <script type="text/javascript"--%>
    <%--            src="http://api.map.baidu.com/api?v=3.0&ak=lewICX42RZIlfELxB6dG81zz5W1juYc6"></script>--%>
    <%--    高德地图API--%>
    <script type="text/javascript"
            src="https://webapi.amap.com/maps?v=1.4.15&key=5702b4a78aee7e6d4704e647d45a5e5d&plugin=AMap.Autocomplete,AMap.PlaceSearch,AMap.DistrictSearch,AMap.Geolocation"></script>
    <%--    项目 css--%>
    <link href="${pageContext.request.contextPath}/front/css/style.css" rel="stylesheet" type="text/css"/>
</head>

<body class="layui-bg-black ">
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
    <ol class="carousel-indicators">
        <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
        <li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
        <li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
    </ol>
    <div class="carousel-inner">
        <div class="carousel-item active">
            <img src="${pageContext.request.contextPath}/front/images/banner.jpg" class="d-block w-100" alt="...">
        </div>
        <div class="carousel-item">
            <img src="${pageContext.request.contextPath}/front/images/10170137_889656.jpg" class="d-block w-100" alt="...">
        </div>
        <div class="carousel-item">
            <img src="${pageContext.request.contextPath}/front/images/4875-fyrcsrv8762382.jpg" class="d-block w-100" alt="...">
        </div>
    </div>
    <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
        <span class="carousel-control-prev-icon" aria-hidden="true"></span>
        <span class="sr-only">Previous</span>
    </a>
    <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
        <span class="carousel-control-next-icon" aria-hidden="true"></span>
        <span class="sr-only">Next</span>
    </a>
</div>

<div id="" class="container " >
    <form id="registerForm" method="post">
        <div class="form-group col-5">
            <input type="text" class="form-control" id="name" name="name" placeholder="设置用户名" required="">
        </div>

        <div class="form-group col-5">
            <input type="password" class="form-control" name="psw"  id="pwd"  placeholder="设置密码"  required="">
        </div>

        <div class="form-group">
            <button id="sendInfo" class="btn btn-primary">注&nbsp; &nbsp;册 </button>
        </div>
    </form>
</div>




</body>
<!-- //footer -->
</body>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.js"></script>
<script>
    $(document).ready(function () {
        //发送验证码
        $("#checkNumber").click(function () {
            var phone =$("#number").val();
            $("#numberCheck").prop("readonly",false);
            $.ajax({
                url:"/number",
                async:true,
                data:{phone:phone},
                success:function (result) {

                },
                error:function () {
                    alert("异步请求失败");
                }
            })
        })
        //验证验证码
        $("#numberCheck").blur(function () {
            var numberCheck =$("#numberCheck").val();
            $.ajax({
                url:"/numberCheck",
                async:true,
                data:{numberCheck:numberCheck},
                success:function (result) {
                    if(result=="true"){
                        alert("验证码正确");

                    }else{
                        alert("验证码错误");
                        $("#numberCheck").val("");
                    }
                },
                error:function () {
                    alert("异步请求失败");
                }
            })
        })
        $("#sendInfo").click(function () {
            var formData = $("#registerForm").serialize();

            $.ajax({
                url:"/courierLoginController/register",
                async:false,
                type:"post",
                data:formData,
                success:function (result) {
                    if(result == "true"){

                        alert("注册成功");
                        location.href = "about.jsp";
                    }else{

                        alert("注册失败!");

                    }
                },
                error:function () {
                    alert("异步请求失败");
                }
            })
        })

    })
</script>
</html>